var exportpic = {
	markers: {},
	layers:[
		{pics:['DT_10_', 'DT_20_', 'DT_30_','DT_40_','DT_50_','DT_60_','DT_70_','DT_75_','DT_80_','DT_90_','DT_95_','DT_100_',
		                'IS_10_', 'IS_20_', 'IS_30_','IS_40_','IS_50_','IS_60_','IS_70_','IS_75_','IS_80_','IS_90_','IS_95_','IS_100_',
		                'Killed_10_', 'Killed_20_', 'Killed_30_','Killed_40_','Killed_50_','Killed_60_','Killed_70_','Killed_75_','Killed_80_','Killed_90_','Killed_95_','Killed_100_',
		                'Opened_10_', 'Opened_20_', 'Opened_30_','Opened_40_','Opened_50_','Opened_60_','Opened_70_','Opened_75_','Opened_80_','Opened_90_','Opened_95_','Opened_100_',
		                'Redundant_10_', 'Redundant_20_', 'Redundant_30_','Redundant_40_','Redundant_50_','Redundant_60_','Redundant_70_','Redundant_75_','Redundant_80_','Redundant_90_','Redundant_95_','Redundant_100_',
		                'Rejected_10_', 'Rejected_20_', 'Rejected_30_','Rejected_40_','Rejected_50_','Rejected_60_','Rejected_70_','Rejected_75_','Rejected_80_','Rejected_90_','Rejected_95_','Rejected_100_',
		                'Watch_10_', 'Watch_20_', 'Watch_30_','Watch_40_','Watch_50_','Watch_60_','Watch_70_','Watch_75_','Watch_80_','Watch_90_','Watch_95_','Watch_100_'],
		           root:"images/ppicons/"},
        {pics:['Closed_', 'DT_', 'IS_'],root:"images/storeicons/"},
        
        {pics:['burgerking','busstop','dfjb','dicos','home','kfc','leisure','metrostation','other',
                     'pizzahut','poi','school','shop','thub','work','yongheking','SP'],root:"images/mapicons/"}
        
	],
	
	init: function() {
	
		for (var i = 0; i < exportpic.layers.length; i++) {
			var node = exportpic.layers[i];
			for (var j = 0; j < node.pics.length; j++){
				var path = node.root + node.pics[j] + '.png';
				exportpic.markers[node.pics[j]] = path;
			}
		}
		// 将本地图片转换为base64编码
		for (var name in exportpic.markers) {
			(function(n) {
				exportpic.base64(exportpic.markers[n], function(data) {
					exportpic.markers[n] = data;
				});
			})(name);
		}
	},
	
	base64: function(url, callback) {
    	if (!url) {
    		return null;
    	}
    	var img = new Image();
    	img.src = url;
    	
    	img.onload = function() {
    		var canvas = document.createElement('canvas');
    		canvas.width = img.width;
    		canvas.height = img.height;
    		
    		var ctx = canvas.getContext('2d');
    		ctx.drawImage(img, 0, 0, img.width, img.height);
    		callback(canvas.toDataURL());
    	};
    }
};